<!--suppress ALL -->
<include file="./Template/header.html" />
<link rel="stylesheet" type="text/css" href="/Template/css/teamList.css">
<script type="text/javascript">

	$(function() {

		//初始化页面配置
		document.title = "团胜成员列表";

		var app = new Vue({
			el: '#container',
			data: {
				memberList: [],
			},
			methods: {
				index: indexPage,
				order: orderPage,
				rank: rankPage,
				center: centerPage,
			}
		})

		var pageNum = 1;
		var isNeedRefresh = false;

		$(window).scroll(function(){

			var scrollTop = $(this).scrollTop();
			var scrollHeight = $(document).height();
			var windowHeight = $(this).height();
			if(!isNeedRefresh &&
					(scrollHeight - scrollTop - windowHeight <= 25)){
				isNeedRefresh = true;
				refreshPage(pageNum++);
			}
		});

		function refreshPage(pageNum) {
			$.ajax({
				url:"/wechat/product/winMemberList",
				type:"post",
				data:{
					id: '{$group.group_id}',
					pageNum: pageNum
				},
				dataType:"JSON",
				beforeSend:function(){
					$("#loadingToast").show();
				},
				complete:function(){
					$('#loadingToast').hide();
				},
				success:function(data){
					if(!isNullOrEmpty(data)) {
						app.memberList = app.memberList.concat(data);
						isNeedRefresh = false;
					}
				},
			})
		}

		function initPage() {
			$.ajax({
				url:"/wechat/product/winMemberList",
				type:"post",
				data:{
					id: '{$group.group_id}',
					pageNum: pageNum++
				},
				dataType:"JSON",
				beforeSend:function(){
					$("#loadingToast").show();
				},
				complete:function(){
					$('#loadingToast').hide();
				},
				success:function(data){
					app.memberList = data;
				},
			})
		}

		initPage();

	});

</script>
<div class="team-list">
	<div class="win-tag">恭喜以下全团中奖</div>
	<if condition="$sameCustomer">

		<div class="user-info">
			<div class="header-img-tag">团长</div>
			<div class="win-img-tag">中奖</div>
			<div class="user-img" style="background:url('{$winner.headimgurl}')no-repeat center;background-size: cover;"></div>
			<div class="user-title color-font">
				<p class="user-name">{$winner.nickname}</p>
				<p class="have-num color-99">购买<span class="color-font">{$winner.number}</span>份</p>
			</div>
			<div class="get-money color-99">
				获得奖金
				<span>{:round($winner["reward"] * $rax,2)}</span>
			</div>
		</div>
		<div class="last-pay-person">
			<div class="last-pay-zone">
				<div class="user-name">用户</div>
				<div class="pay-time">时间</div>
				<div class="bingo-code">依据</div>
			</div>
			<foreach name="recordList" item="vo">
				<div class="last-pay-zone">
					<div class="user-name">{$vo.nickname}</div>
					<div class="pay-time">{$vo.time}</div>
					<div class="bingo-code">{$vo.time_code}</div>
				</div>
			</foreach>
		</div>
		<div class="formulaCalculate">
			<p>取以下数值结果得：<br/>
				1、求和：{$totalNumber}（截止该时间点本站全部商品的最后5个参与时间取值相加之和）<br/>
				2、取余：{$totalNumber}（5条时间记录之和）%{$product.price}（本商品总需参与人次）={$leftNumber}（余数）<br/>
				3、计算结果：{$leftNumber}（余数）+10000001={$round.win_order_code}
			</p>
		</div>

	<else/>
		<div class="user-info">
			<div class="win-img-tag">中奖</div>
			<div class="user-img" style="background:url('{$winner.headimgurl}')no-repeat center;background-size: cover;"></div>
			<div class="user-title color-font">
				<p class="user-name">{$winner.nickname}</p>
				<p class="have-num color-99">购买<span class="color-font">{$winner.number}</span>份</p>
			</div>
			<div class="get-money color-99">
				获得奖金
				<span>{:round($winner["reward"]* $rax,2)}</span>
			</div>
		</div>
		<div class="last-pay-person">
			<div class="last-pay-zone">
				<div class="user-name">用户</div>
				<div class="pay-time">时间</div>
				<div class="bingo-code">依据</div>
			</div>
			<foreach name="recordList" item="vo">
				<div class="last-pay-zone">
					<div class="user-name">{$vo.nickname}</div>
					<div class="pay-time">{$vo.time}</div>
					<div class="bingo-code">{$vo.time_code}</div>
				</div>
			</foreach>
		</div>
		<div class="formulaCalculate">
			<p>取以下数值结果得：<br/>
				1、求和：{$totalNumber}（下面5条购买记录时间取值相加之和）<br/>
				2、取余：{$totalNumber}（5条时间记录之和）%{$product.price}（本商品总需参与人次）={$leftNumber}（余数）<br/>
				3、计算结果：{$leftNumber}（余数）+10000001={$round.win_order_code}
			</p>
		</div>
		<div class="user-info">
			<div class="header-img-tag">团长</div>
			<div class="user-img" style="background:url('{$groupMember.headimgurl}')no-repeat center;background-size: cover;"></div>
			<div class="user-title color-font">
				<p class="user-name">{$groupMember.nickname}</p>
				<p class="have-num color-99">购买<span class="color-font">{$groupMember.number}</span>份</p>
			</div>
			<div class="get-money color-99">
				获得奖金
				<span>{:round($groupMember["reward"] * $rax,2)}</span>
			</div>
		</div>
	</if>

	<div class="user-info" v-for="member in memberList">
		<div class="user-img" style="background:url('{{member.headimgurl}}')no-repeat center;background-size: cover;"></div>
		<div class="user-title color-font">
			<p class="user-name">{{member.nickname}}</p>
			<p class="have-num color-99">购买<span class="color-font">{{member.number}}</span>份</p>
		</div>
		<div class="get-money color-99">
			获得奖金
			<span>{{member.reward}}</span>
		</div>
	</div>
</div>
<include file="./Template/footer.html" />